<template>
  <page>
    <SideMenu :menu-list="menus" @on-select="onSelectMenu">
      <div slot="toolbar">
        ttt
      </div>
      <div slot="footbar">
        ttt
      </div>
    </SideMenu>
    <Tabs value="name1" style="flex:1">
      <TabPane label="页面" name="name1">标签一的内容</TabPane>
      <TabPane label="数据字典" name="name2">标签二的内容</TabPane>
      <TabPane label="应用接口" name="name3">标签三的内容</TabPane>
    </Tabs>
  </page>
</template>

<script>
import { mapActions } from "vuex";
import SideMenu from "./components/side-menu/index";
export default {
  components: {
    SideMenu
  },
  data() {
    return {
      config: {}
    };
  },
  mounted() {
    this.open();
  },
  computed: {
    menus() {
      return this.config.pages || [];
    }
  },
  methods: {
    ...mapActions(["readfile"]),

    open() {
      const params = {
        dir: "/Users/wangxin/workspace/datong/blt/v1/webapp/misc",
        file: "config.json"
      };
      this.readfile(params)
        .then(res => {
          this.config = res.data;
          console.info(this.config);
        })
        .catch(this.$Error);
    },

    onSelectMenu(name) {
      console.info(name);
    }
  }
};
</script>
